import torch

conf = True
# 获取gpu的设备的写法
device = torch.device("cuda" if torch.cuda.is_available()
                                and not conf else "cpu")
n_gpu = torch.cuda.device_count()
print(device,n_gpu)
